<?php
/**
 * jobber and worker's abstract interface
 */
abstract class AbsMemcacheQueueJobberWorker {
	protected $cfg;
	protected $queue;
	
	/**
	 * construct function
	 */
	public function __construct($cfg = array()) {
		$this->setCfg($cfg);
		$this->setQueue();
	}
	
	/**
	 * set config
	 */
	protected function setCfg($cfg) {
		$this->initCfg();
		
		foreach($cfg as $key => $val) {
			if(array_key_exists($key, $this->cfg)) $this->cfg[$key] = $val;
		}
	}
	
	protected function setQueue() {
		$this->queue = new MemcacheQueue($this->cfg);
	}
	
	abstract protected function initCfg();
}
?>